home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
TURB_VIS
/
ALEXLEVI
/
DEMO
/
DEMO_KBD.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-04-12
|
3KB
|
71 lines
(*
****************************************************************************
* *
* This function was made by Alex Levitas' "Keyboard Map Editor". *
* *
****************************************************************************
This function convert single character from standard keyboard map to new.
May be used after reading single character from keyboard. Use
ConvertChar(ReadKey) call instead of ReadKey call.
To use this function in your program, insert the directive
{$I DEMO_KBD.PAS}
If you want to use more than one keyboard map in your program, you
must change function name in each source file.
*)
function ConvertChar(PressedChar: Char): Char;
const
PreviousChar: Char = #255;
const
KeyboardChars: String[92] = (
#126#096#033#049#064#050#035#051#036#052 +
#037#053#094#054#038#055#042#056#040#057 +
#041#048#095#045#043#061#081#113#087#119 +
#069#101#082#114#084#116#089#121#085#117 +
#073#105#079#111#080#112#123#091#125#093 +
#065#097#083#115#068#100#070#102#071#103 +
#072#104#074#106#075#107#076#108#058#059 +
#034#039#090#122#088#120#067#099#086#118 +
#066#098#078#110#077#109#060#044#062#046 +
#063#047
);
Convert_Chars: String[92] = (
#126#096#033#049#034#050#058#051#047#052 +
#037#053#044#054#046#055#063#056#040#057 +
#041#048#095#045#043#061#137#169#150#230 +
#147#227#138#170#133#165#141#173#131#163 +
#152#232#153#233#135#167#149#229#154#234 +
#148#228#155#235#130#162#128#160#143#175 +
#144#224#142#174#139#171#132#164#134#166 +
#157#237#159#239#151#231#145#225#140#172 +
#136#168#146#226#156#236#129#161#158#238 +
#240#241
);
var
TmpCh: Char;
begin
ConvertChar := PressedChar;
TmpCh := PreviousChar;
PreviousChar := PressedChar;
if TmpCh = #0 then Exit;
if Pos(PressedChar, KeyboardChars) <> 0 then
if Convert_Chars[Pos(PressedChar, KeyboardChars)] <> #0 then
ConvertChar := Convert_Chars[Pos(PressedChar, KeyboardChars)];
end;